<?php
namespace classlib;
require 'cache/cache.int.php';
use classlib\cache\Icache;
class cache {
	static $cache = array();
	/**
	 * 工厂函数获取Icache
	 * @param string $engin 需要获取的Cache引擎
	 * @return Icache $instance 缓存实例
	 */
	public static function inst($cls='file') {
		if (!isset(self::$cache[$cls])) {
			$conf = core\config::load('cache/'.$cls, false);
			$clns = 'classlib\cache\\cache_'.$cls;
			require 'cache/cache_'.$cls.'.cls.php';
			self::$cache[$cls] = new $clns($conf);
		}
		return self::$cache[$cls];
	}
}